package com.jjyd.crlp.domain.entity;

import com.jjyd.crlp.domain.entity.type.LanguageType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.joda.time.LocalDateTime;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * 字典
 */
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Data
@EntityListeners(AuditingEntityListener.class)
@Table(name = "dictionary")
public class Dictionary {

    /**
     * id主键，自动递增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id",columnDefinition = "int COMMENT '主键id'")
    private Integer id;

    /**
     * 目标语言
     */
    @Column(name = "target_language",nullable = false,columnDefinition = "varchar(255) COMMENT '目标语言'")
    private String targetLanguage;

    /**
     * 目标语言类型
     */
    @Column(name = "target_language_type",nullable = false,columnDefinition = "int COMMENT '目标语言类型'")
    private LanguageType targetLanguageType;


    /**
     * 原始语言
     */
    @Column(name = "original_language",nullable = false,columnDefinition = "varchar(255) COMMENT '原始语言'")
    private String originalLanguage;

    /**
     * 原始语言类型
     */
    @Column(name = "original_language_type",nullable = false,columnDefinition = "int COMMENT '原始语言类型'")
    private LanguageType originalLanguageType;

    /**
     * 例句
     */
    @Lob
    @Column(name = "example", columnDefinition = "text COMMENT '例句'")
    private String example;

    /**
     * 是否删除，默认false
     */
    @Column(name = "remove",nullable = false,columnDefinition = "bit COMMENT '是否删除，默认false'")
    private Boolean remove = false;

    /**
     * 创建时间
     */
    @Column(name = "create_time",columnDefinition = "DATETIME COMMENT '创建的时间'")
    @CreatedDate
    private LocalDateTime createTime;

    /**
     * 最后一次更新时间
     */
    @Column(name = "update_time",columnDefinition = "DATETIME COMMENT '更新时间'")
    @LastModifiedDate
    private LocalDateTime updateTime;

}
